var Popup = {
    showAllCampuses : function(){
        $("#modifiedMsg").html("");
        $("#allSchool").show();
    },
    closeBtn  : function (){
        $("#modifiedMsg").html("");
        $("#allSchool").hide();
    },
    showArea : function(id){//get the province generate the school info
        $("#modifiedMsg").html("");
        var url = $('#baseurl').val()+"/customer/agent/rendercampus";
        $.post(url, {
            "areaDictId": id
        },
        function (data){
            $("#allCampuses").html(data);           
        },'html');
    },
    viewArea : function(areaName, id){//set the value to textbox and hidden box , show campuses ambassador if it exist else do not show
        $("#campusesName").val(areaName);
        $('#campusesID').val(id);
        $("#allSchool").hide();
        $("#campusesName").focus();
        $('#deputyErroMsg').html("");
        $("#modifiedMsg").html("");
        Popup.adddeputy();
        if($('#deputy').attr('checked')){
            $('#highdeputy').show();
        }
    },
    viewDeputy : function (id){
        $("#deputyID").val(id);
        $("#modifiedMsg").html("");
    },
    adddeputy : function (){
        var campusID = $("#campusesID").val();
        var userID = $("#userid").val();
        if(campusID == '0' || campusID == "" || campusID == null){
            $("#deputyErroMsg").html("<font color ='red'>请选择高校</font>");
            return;
        }
        var url = $('#baseurl').val()+"/customer/agent/renderambassador";
        $.post(url, {
            "campusID": campusID,
            "userID" : userID
        },
        function (data){
            $("#deputyDiv").html(data);
        },'html');
    },
    
    viewAreaCampus: function(areaName, id){//set the value to textbox and hidden box , show campuses ambassador if it exist else do not show
        $("#campusesName").val(areaName);
        $('#campusesID').val(id);
        $("#allSchool").hide();
        $("#campusesName").focus();
        $('#deputyErroMsg').html("");
        $("#modifiedMsg").html("");
        
    },
    
    clearCampuses: function(){
    	$("#campusesName").val('');
        $('#campusesID').val(0);
    }
}